package com.silence.gmall.generator;

/**
 * @Author silence
 * @Email 792245022@qq.com
 * @Date 2025-06-10 15:59
 * @Description 生成器主类
 */
public class GeneratorMain {

    public static void main(String[] args) {
        // 生成 coupon 模块代码
        // generateCouponCode();

        // 如果需要生成其他模块代码，可以添加对应的方法
        generateProductCode();
        // generateWareCode();
        // generateMemberCode();
        // generateOrderCode();
    }

    /**
     * 生成优惠券模块代码
     */
    private static void generateCouponCode() {
        // 定义模块名称
        String moduleName = "coupon";
        // 定义表前缀
        String tablePrefix = "";
        // 定义要生成的表，可以指定多个表名
        String[] tables = {
                "sms_coupon",
                "sms_coupon_history",
                "sms_coupon_spu_category_relation",
                "sms_coupon_spu_relation",
                "sms_home_adv",
                "sms_home_subject",
                "sms_home_subject_spu",
                "sms_member_price",
                "sms_seckill_promotion",
                "sms_seckill_session",
                "sms_seckill_sku_notice",
                "sms_seckill_sku_relation",
                "sms_sku_full_reduction",
                "sms_sku_ladder",
                "sms_spu_bounds"
        };

        // 调用生成器生成代码
        MyBatisPlusGenerator.generate(moduleName, tablePrefix, tables);
    }

    /**
     * 生成商品模块代码
     */
    private static void generateProductCode() {
        String moduleName = "product";
        String tablePrefix = "";
        String[] tables = {
                // 添加商品模块的表
                "base_attr_info",
                "base_attr_value",
                "base_category1",
                "base_category2",
                "base_category3",
                "base_sale_attr",
                "base_trademark",
                "sku_attr_value",
                "sku_image",
                "sku_info",
                "sku_sale_attr_value",
                "spu_image",
                "spu_info",
                "spu_poster",
                "spu_sale_attr",
                "spu_sale_attr_value"
        };

        MyBatisPlusGenerator.generate(moduleName, tablePrefix, tables);
    }

    /**
     * 生成仓储模块代码
     */
    private static void generateWareCode() {
        String moduleName = "ware";
        String tablePrefix = "";
        String[] tables = {
                // 添加仓储模块的表
                "wms_purchase",
                "wms_purchase_detail",
                "wms_ware_info",
                "wms_ware_order_task",
                "wms_ware_order_task_detail",
                "wms_ware_sku"
        };

        MyBatisPlusGenerator.generate(moduleName, tablePrefix, tables);
    }

    /**
     * 生成会员模块代码
     */
    private static void generateMemberCode() {
        String moduleName = "member";
        String tablePrefix = "";
        String[] tables = {
                // 添加会员模块的表
                "ums_growth_change_history",
                "ums_integration_change_history",
                "ums_member",
                "ums_member_collect_spu",
                "ums_member_collect_subject",
                "ums_member_level",
                "ums_member_login_log",
                "ums_member_receive_address",
                "ums_member_statistics_info"
        };

        MyBatisPlusGenerator.generate(moduleName, tablePrefix, tables);
    }

    /**
     * 生成订单模块代码
     */
    private static void generateOrderCode() {
        String moduleName = "order";
        String tablePrefix = "";
        String[] tables = {
                // 添加订单模块的表
                "oms_order",
                "oms_order_item",
                "oms_order_operate_history",
                "oms_order_return_apply",
                "oms_order_return_reason",
                "oms_order_setting",
                "oms_payment_info",
                "oms_refund_info"
        };

        MyBatisPlusGenerator.generate(moduleName, tablePrefix, tables);
    }
}
